package com.demo.common.redis.delay;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;

/**
 * <p>
 * 延迟消息配置
 * </p>
 *
 * @author molong
 * @date 2022/6/22
 */
@Configuration
public class BaseDelayMessageConfig {

    /**
     * 定义消息处理容器
     * @param factory redis连接对象
     * @return DelayMessageListenerContainer
     */
    @Bean
    public DelayMessageListenerContainer delayMessageListenerContainer(RedisConnectionFactory factory){
        return new DefaultDelayMessageListenerContainer(factory);
    }
}
